package com.googlecode.openauth.web.service.impl;

import java.util.List;

import org.apache.ibatis.session.RowBounds;
import org.apache.ibatis.session.SqlSession;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

public class pageTest {

	private static ApplicationContext context;
	
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		context = new FileSystemXmlApplicationContext("/src/applicationContext.xml");
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
	}
	
	@Test
	public void testPage() {
		try {
			org.apache.ibatis.session.defaults.DefaultSqlSessionFactory defaultF = (org.apache.ibatis.session.defaults.DefaultSqlSessionFactory)context.getBean("sqlSessionFactory");
			SqlSession session = defaultF.openSession(true);
			List list = session.selectList("com.googlecode.openauth.web.dao.IActionDao.getAction", null, new RowBounds(2, 2));//RowBounds(offset,limit)
			List list1 = session.selectList("com.googlecode.openauth.web.dao.IActionDao.IActionDao.getActionByDesc", "desc", new RowBounds(0, 2));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
